#pragma once
#include "definitions.h"
#include <qimage.h>

namespace ACCAD
{
    class Bitmap
    {
    public:

        static Color* load(const std::wstring &file_name, uint &w, uint &h)
        {
            QImage img(QString::fromWCharArray(file_name.c_str()));
            
            w = img.width();
            h = img.height();
            uint n = w * h;

            Color *c = new Color[n];
            unsigned char *p = img.bits();
            for (uint i = 0; i < n; i++)
            {
                c[i].b = *(p++);
                c[i].g = *(p++);
                c[i].r = *(p++);
                c[i].a = *(p++);
            }
                
            return c;
        }
    };
}